package com.example.demo.controller;

import com.example.demo.model.ReadList;
import com.example.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class UserController {
    @Value("${server.port}") //读取配置项
    private Integer port;

    @Value("${mystring}") //读取配置项
    private String mystring;
    @Value("${mystring2}") //读取配置项
    private String mystring2;
    @Value("${mystring3}") //读取配置项
    private String mystring3;
    @Autowired
    private Student student;
    @Resource
    private ReadList readList;


    @ResponseBody //返回一个非静态页面的数据
    @RequestMapping("/sayhi")//设置路由地址
    public  String sayHi(){
//        System.out.println("mystring:"+mystring);
//        System.out.println("mystring2:"+mystring2);
//        System.out.println("mystring3:"+mystring3);

       // return "student:" + student;
        return "readList:"+ readList.getName();
    }
}
